package com.starchen.optimalselection.common.exception;

import com.starchen.optimalselection.common.utils.ResponseEnum;
import lombok.Data;

@Data
public class CustomException extends RuntimeException{

    //错误码
    private Integer code;
    //错误消息
    private String message;

    /**
     *
     * @param message 错误消息
     * @param code 错误码
     */
    public CustomException(Integer code,String message) {
        this.message = message;
        this.code = code;
    }

    /**
     *
     * @param resultCodeEnum 接收枚举类型
     */
    public CustomException(ResponseEnum resultCodeEnum) {
        this.message = resultCodeEnum.getMessage();
        this.code = resultCodeEnum.getCode();
    }

}
